/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.view.symbols;

import java.awt.Graphics2D;
import org.jfonia.assets.fonts.TextGlyph;
import org.jfonia.connect5.basics.MutableValueNode;
import org.jfonia.connect5.basics.ValueNode;

/**
 *
 * @author Rik Bauwens
 */
public abstract class PrimitiveStaffSymbol extends RankedStaffSymbol {

        protected TextGlyph textGlyph;

        public PrimitiveStaffSymbol(ValueNode<Double> frameX, ValueNode<Double> staffY,
                                    MutableValueNode<Double> staffBase, MutableValueNode<Double> postStaffBase,
                                    ValueNode<Double> xNode, MutableValueNode<Double> widthNode,
                                    MutableValueNode<Integer> rankNode)
        {
                super(frameX, staffY, staffBase, postStaffBase, xNode, widthNode, rankNode);
        }

        protected void updateNodes()
        {
                preXNode.setValue(textGlyph.getBounds().getMinX());
                postXNode.setValue(textGlyph.getBounds().getMaxX());
                preYNode.setValue(- textGlyph.getBounds().getMinY());
                postYNode.setValue(textGlyph.getBounds().getMaxY());
                //requestRepaint();
        }
/*
        @Override
        public double getPreX()
        {
                return super.getPreX() + textGlyph.getBounds().getMinX();
        }

        @Override
        public double getPostX()
        {
                return super.getPostX() + textGlyph.getBounds().getMaxX();
        }

        @Override
        public double getPreY()
        {
                return super.getPreY() - textGlyph.getBounds().getMinY();
        }

        @Override
        public double getPostY()
        {
                return super.getPostY() + textGlyph.getBounds().getMaxY();
        }*/

        @Override
        public void paintSymbol(Graphics2D g)
        {
                super.paintSymbol(g);
                textGlyph.paint(g, Math.ceil(getX()), Math.ceil(getY()));
        }
}
